package com.nbgroup.dao;

import com.nbgroup.entity.Literature;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface LiteratureRepositoty extends JpaRepository<Literature,Integer>, JpaSpecificationExecutor<Literature> {
    @Query("select l from Literature l where l.exhibtionId = :exhibtionId")
    List<Literature> findLiteratureByExhibtionId(@Param("exhibtionId") Integer exhibtionId);

    @Query("select l from Literature l where l.exhibtionId = :exhibtionId and l.literatureType = 2")
    List<Literature> findLiteratureListByExhibtionId(@Param("exhibtionId") Integer exhibtionId);
}
